{% extends 'cms/base.html' %}
{% block title %}员工管理{% endblock %}
{% block content-header %}<h3>员工管理</h3>{% endblock %}

{% block content %}
<div class="row">
  <div class="col-md-12">
    <div class="box box-primary">
        <div class="box-header">
            <a href="{% url 'cms:add_staff' %}" id="add-btn"  class="btn btn-primary">
                添加员工
            </a>
        </div>
        <div class="box-body">
            <table class="table table-bordered">
                <thead>
                    <tr>
                        <th>用户名</th>
                        <th>手机号</th>
                        <th>所属分组</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    {% for staff in staffs %}
                        <tr>
                            <td>{{ staff.username }}</td>
                            <td>{{ staff.telephone }}</td>
                            <td>
                                {% if staff.is_superuser %}
                                    超级管理员
                                {% else %}
                                    {% for group in staff.groups.all %}
                                        {{ group.name }} /
                                    {% endfor %}
                                {% endif %}
                            </td>
                            <td>
                                <button class="btn btn-info btn-xs">编辑</button>
                                <button class="btn btn-danger btn-xs">删除</button>
                            </td>
                        </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>
    </div>
  </div>
</div>
{% endblock %}



